<!--设置模块唯一ID-->
<div id="system_quanxianguanli">
<!--标题、面包屑-->
<section class="content-header">
    <h1>
        菜单管理
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li>系统管理</li>
        <li class="active">权限管理</li>
    </ol>
</section>
<!--列表-->
<section class="content">
    <div class="form-horizontal">
        <div class="form-group">
            <div class="col-sm-3 u_userList">
                <dl>
                    <dt>
                        <i class="fa fa-fw fa-group"></i>岗位树
                    </dt>
                </dl>
                <div data-plugin="orgTree"></div>
            </div>

            <div class="col-sm-9 u_contextWrap">
            </div>
        </div>
    </div>
</section>

<script type="text/template" data-for="tp_editor">
</script>

<script>
	USEN(function (param) {
        //模块ID(全系统唯一)
        var id = "#system_quanxianguanli";
        var role = "system_quanxianguanli_permission";

        //定义页面变量
        var $el = $(id);
        var $container = $el.find('.u_contextWrap:first');
        var base = USEN.CONST.baseUrl;
        
        //初始化用户树结构
        var $orgTree = $el.find("[data-plugin=orgTree]").on("changed.jstree", function (e, data) {
            if (data.selected.length && data.action == 'select_node') {
                var type = data.node.type;
                var nodeId = data.node.id.split(";")[1];
//                if(type == 'role'){
                    USEN.fill({
                        selector:$container,
                        url:base + USEN.router[role].url,
                        param:{id:nodeId},
                        success:function(o){
                            console.log('加载岗位权限完毕');
                        }
                    })
//                }
            }

        }).jstree({
            'core': {
                'themes': {
                    'name': 'proton'
                },
                data: {
                	url: function(node) {
                    	var nodeId = node.id;
                    	if(node.id == '#') {
                    		nodeId = "top;0";
                    	}
//                    	return '/renliziyuan/department/getDepartmentTree?nodeId='+nodeId+'&hasUser=0';
                        return './simdata/common_org_tree_root_action.json';
                    },
                    data:function(node){
                        return {
                            v : new Date().getTime()
                        }
                    }
                }
            },
            "plugins": [ "wholerow" , "types"],
            "types": {
            	"org": {
                    "icon": "fa fa-fw fa-group"
                },
                "dept": {
                    "icon": "fa fa-fw fa-male"
                },
                "role": {
                    "icon": "fa fa-fw fa-user"
                }
            }
        });
    });
</script>
</div>